package com.ruoyi.system.api;

import java.util.List;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysDictData;
import com.ruoyi.system.api.factory.RemoteSysDictDataFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;


/**
 * 字典数据微服务接口
 * 
 * @author ruoyi
 * @date 2023-04-27
 */
@FeignClient(contextId = "remoteSysDictDataService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSysDictDataFallbackFactory.class)
public interface RemoteSysDictDataService
{
    /**
     * 查询字典数据
     * 
     * @param dictCode 字典数据主键
     * @return 字典数据
     */
    @GetMapping("/inner/data/{dictCode}")
    public R<SysDictData> selectSysDictDataByDictCode(@PathVariable("dictCode") Long dictCode, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 查询字典数据列表
     * 
     * @param sysDictData 字典数据
     * @return 字典数据集合
     */
    @PostMapping("/inner/data/list")
    public R<List<SysDictData>> selectSysDictDataList(SysDictData sysDictData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 新增字典数据
     * 
     * @param sysDictData 字典数据
     * @return 结果
     */
    @PostMapping("/inner/data")
    public R<Integer> insertSysDictData(@RequestBody SysDictData sysDictData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 修改字典数据
     * 
     * @param sysDictData 字典数据
     * @return 结果
     */
    @PutMapping("/inner/data")
    public R<Integer> updateSysDictData(@RequestBody SysDictData sysDictData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 批量删除字典数据
     * 
     * @param dictCodes 需要删除的字典数据主键集合
     * @return 结果
     */
    @DeleteMapping("/{dictCodes}")
    public R<Integer> deleteSysDictDataByDictCodes(@PathVariable("dictCodes") Long[] dictCodes, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
